package com.zzy.dao;

import model.AutoCode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @Author: zhangzhenyu
 * @Date: 2021/2/5
 */

public interface EmailDao extends JpaRepository<AutoCode,Integer> {

    @Transactional
    @Modifying
    @Query(value="update AutoCode  set code=:code ,expiretime=:expiretime  where email =:email")
    public int sendEmail(@Param("code") String code, @Param("email") String email, @Param("expiretime") Date expiretime);
}
